{{ include("common/header.html")}}
<div class="admin">
    {{ include("common/nav.html")}}
    <script src="{{_G['APP']}}/resource/js/jquery-1.4.2.min.js"></script>
    <div class="aright">
        <div class="arz" style="float: left;margin: 0px 20px 20px 30px;"><a href="{{_G['APP_URL']}}?m=admin&c=classify&a=add"><i class="layui-icon">&#xe608;</i>添加分类</a></div>

       <!-- <div style="float: left;">
            <form class="layui-form" action="/admin.php/article/index.html" method="get">
                <input placeholder="输入关键字" name="kw" value="" type="text" class="layui-input" style="float: left;margin-right: 10px;width: 300px;">
                <button class="layui-btn" style="float: left;" value="查询" type="submit">查询</button>
            </form>
        </div>-->

        <form method="post" class="aform cl">
            <table width="100%">
                <tbody><tr>
                    <th width="10%" align="center">编号</th>
                    <th width="20%" align="center">分类名称</th>
                    <th width="10%" align="center">分类等级</th>
                    <!--<th width="20%" align="center">栏目图片</th>-->
                    <th width="20%" align="center">添加时间</th>
                    <th width="20%" align="center">基本操作</th>
                </tr>
                {% for data in list %}
                <tr>
                    <td align="center">{{loop.index}}</td>
                    <td style="padding-left: 20px;"><a target="_blank" href="/blog/index.php?m=Home&amp;c=index&amp;a=category&amp;id=1">{{data.name}}</a></td>
                    <td align="center">{{data.level}}</td>
                    <!--<td align="center">暂无图片</td>-->
                    <td align="center">{{data.create_time|date('Y-m-d H:i')}}</td>
                    <td align="center">
                        <a href="{{ G.url('admin/classify/edit',{id:data.id})}}"><i class="layui-icon" style="font-size: 20px; color: #009688;">&#xe642;</i> 修改</a>
                        <a href="javascript:void(0)" onclick="del('{{ data.id }}');"><i class="layui-icon" style="font-size: 20px; color: #009688;">&#xe640;</i> 删除</a>
                    </td>
                </tr>
                {% endfor %}
                </tbody></table>
        </form>
        <div class="pages">
            <div id="pages"></div>
        </div>
    </div>
</div>
<script>
    $("#selall").click(function(){
        if($(this).attr("checked")){
            $(".selall").attr("checked","checked");
        }else{
            $(".selall").removeAttr("checked");
        }

    })

    /**
     * 构造分页功能
     */
    layui.use('laypage', function() {
        var laypage = layui.laypage;
        //完整功能
        laypage.render({
            elem: 'pages',
            count: "{{pagination.total}}", //数据总数，从服务端得到
            limit: "{{pagination.page_size}}",
            curr: "{{pagination.current_page}}",
            layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
            , jump: function (obj, first) {
                var url = "{{ G.url('admin/classify/classifyList',{'current_page':'currs','page_size':'limit'})}}";
                /**
                 * 替换处理
                 * @type {string}
                 */
                url = url.replace("currs", obj.curr);
                url = url.replace("limit", obj.limit);
                //首次不执行
                if (!first) {
                    window.location.href = escapeUrl(url);//转义amp字符
                }
            }
        });
    });

    function del(id){
        layui.use('layer', function(){
            var layer = layui.layer;

            //信息框-例2
            layer.msg('您确定要删除吗？', {
                time: 0 //不自动关闭
                ,btn: ['确定', '取消']
                ,yes: function(index){
                    var url="{{ G.url('admin/classify/delete',{'id':'classifyid'})}}";
                    url = url.replace("classifyid", id);
                    window.location.href=escapeUrl(url);//转义amp字符
                }
            });
        });
    }
</script>
</body>
</html>